# 函数
# def   函数名（  [形参]  ）:
#       代码
#    [  return 值 ]

def p (i):
    a = 0
    while a < i:
        print("1")
        print("2")
        print("3")
        a+=1
# 函数的调用
p(2)

# 函数的分类
# 无参无返回
def myAdd():
    a = 10
    b = 20
    s = a + b
    print(s)
myAdd()

# 有参无返回
def myAdd2(a,b):
    s = a + b
    print(s)

myAdd2(5,6)
myAdd2(10,7)

# 有参有返回
def myAdd3(a,b):
    s = a+b
    return s

#调用
i = myAdd3(5,4)
print(i)
j = i + 20
print(j)

# 无参有返回
def myAdd4():
    a = 10
    b = 20
    s = a + b
    return s
k = myAdd4()
print(k)
9

def sum(a, b):
    # 初始化变量 s
    s = 0

    for i in range(a, b + 1):
        s += i
    return s

# 测试
a = sum(1, 100)
print(a)
